﻿using System;

namespace CommonServiceManager.Configuration
{
	/// <summary>
	/// A pair of a name (of a property) and an implementation key.
	/// </summary>
	public class KeyedName
	{
		/// <summary>
		/// Create a new name/implementation key pair.
		/// </summary>
		/// <param name="name">The name of the property selected for Dependency Injection.</param>
		/// <param name="implementationKey">The implementation key if the property type has more than one implementation in the system.</param>
		/// <exception cref="ArgumentNullException"><paramref name="name"/> cannot be null</exception>
		public KeyedName(string name, string implementationKey = null)
		{
			if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name");

			Name = name;
			ImplementationKey = implementationKey;
		}

		/// <summary>
		/// The name of the name (of the property) selected for Dependency Injection.
		/// </summary>
		public string Name { get; set; }

		/// <summary>
		/// The implementation key if the (property) type has more than one implementation in the system.
		/// </summary>
		public string ImplementationKey { get; set; }
	}
}